home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Stream-GeoFacts.dir / Scripts_65_Misc. Helper Scripts.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  1.2 KB  |  52 lines

  1. on getLabelName theFrame
  2.   set theFrame to default(theFrame, the frame)
  3.   set lastLine to the number of lines in the labelList - 1
  4.   repeat with i = 1 to lastLine
  5.     if theFrame < label(line i of the labelList) then
  6.       if i > 1 then
  7.         return line i - 1 of the labelList
  8.       else
  9.         return EMPTY
  10.       end if
  11.       exit
  12.     end if
  13.   end repeat
  14.   return line lastLine of the labelList
  15. end
  16.  
  17. on default paramVar, defaultVal
  18.   if voidp(paramVar) then
  19.     set paramVal to defaultVal
  20.   else
  21.     set paramVal to paramVar
  22.   end if
  23.   return paramVal
  24. end
  25.  
  26. on localPath thePath
  27.   if the platform contains "Macintosh" then
  28.     set pathDelim to ":"
  29.     set otherDelim to "/"
  30.   else
  31.     set pathDelim to "\"
  32.     set otherDelim to ":"
  33.   end if
  34.   set rVal to replaceString(thePath, otherDelim, pathDelim)
  35.   set rVal to replaceString(thePath, "/", pathDelim)
  36.   return rVal
  37. end
  38.  
  39. on replaceString input, fromChunk, toChunk
  40.   set output to EMPTY
  41.   repeat while input contains fromChunk
  42.     set position to offset(fromChunk, input) - 1
  43.     if position then
  44.       put char 1 to position of input after output
  45.     end if
  46.     put toChunk after output
  47.     delete char 1 to position + length(fromChunk) of input
  48.   end repeat
  49.   put input after output
  50.   return output
  51. end
  52.